package com.fy.fyzf.wifi;

import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;

import java.util.Objects;

import static android.content.Context.WIFI_SERVICE;

public class WifiInConfig {
    public String getWifiMacAddress(Context context) {
        WifiManager wm = (WifiManager) Objects.requireNonNull(context).getApplicationContext().getSystemService(WIFI_SERVICE);
        if (wm != null) {
            WifiInfo winfo = wm.getConnectionInfo();
            return winfo.getBSSID();
        }
        return null;
    }

    public String getWifiName(Context context){
        WifiManager wm = (WifiManager) Objects.requireNonNull(context).getApplicationContext().getSystemService(WIFI_SERVICE);
        if (wm != null) {
            WifiInfo winfo = wm.getConnectionInfo();
            return winfo.getSSID();
        }
        return null;
    }


}
